import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * user:likai
 * Date:2023-01-22
 * Time:19:42
 */
public class Test {
    public static boolean containsDuplicate(int[] nums) {
        HashMap<Integer,Integer> map=new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            if(map.get(nums[i])==null){
                map.put(nums[i],0);
            }else{
                return true;
            }
        }
        return false;
    }
    public static void main(String[] args) {
        HashMap<Integer,Integer> map=new HashMap<>();
        int[] nums={1,2,3,4,2};
        System.out.println(containsDuplicate(nums));
    }
}
